1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.apache.tapestry5.internal.services.assets;
16
17 import org.apache.tapestry5.ioc.test.TestBase;
18 import org.testng.annotations.DataProvider;
19 import org.testng.annotations.Test;
20
21 import java.io.IOException;
22
23 public class ContextAssetRequestHandlerTest extends TestBase
24 {
25 @DataProvider
26 public Object[][] invalid_paths()
27 {
28 return new Object[][]
29 {
30 {"web-Inf/classes/hibernate.cfg.xml"},
31 {"Meta-Inf/MANIFEST.mf"},
32 {"Index.tml"},
33 {"folder/FolderIndex.TML"}};
34 }
35
36 @Test(dataProvider = "invalid_paths")
37 public void ensure_assets_are_rejected(String path) throws IOException
38 {
39 ContextAssetRequestHandler handler = new ContextAssetRequestHandler(null, null);
40
41 assertFalse(handler.handleAssetRequest(null, null, "fake-checksum/" + path),
42 "Handler should return false for invalid path.");
43 }
44 }